<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }
        </script>
        <style type="text/css">
            .col-95 {
                width: 95%;
            }

            .col-5 {
                width: 5%;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px">
            <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
                <p:tab title="海尔卡复核">
                    <h:form>
                        <div id="qrytable">
                            <p:focus for="cardtype"/>
                            <p:growl id="msgs" showDetail="false"/>
                            <p:panel style="margin-top:10px">
                                <h:panelGrid columns="2" cellspacing="5" columnClasses="col-95,col-5">
                                    <h:panelGrid columns="4" cellspacing="5" style="text-align: right;">
                                        <h:outputLabel value="卡种:"/>
                                        <h:selectOneMenu id="cardtype" value="#{cardQryAction.cdtcard.cardtype}"
                                                         style="width: 187px;">
                                            <f:selectItems value="#{cardQryAction.cardTypeOptions}"/>
                                        </h:selectOneMenu>

                                        <h:outputLabel value="所属项目:"/>
                                        <h:selectOneMenu value="#{cardQryAction.cdtcard.projid}" style="width: 187px;">
                                            <f:selectItems value="#{cardQryAction.projOptions}"/>
                                        </h:selectOneMenu>

                                        <h:outputLabel value="卡面额:"/>
                                        <h:inputText value="#{cardQryAction.cdtcard.openamt}" style="width: 187px;">
                                            <f:convertNumber pattern="###,##0.00"/>
                                        </h:inputText>

                                    </h:panelGrid>
                                    <h:panelGrid>
                                        <p:commandButton style="width:90px;" value="查询"
                                                         action="#{cardQryAction.onChkQuery}"
                                                         update="pdt,msgs">
                                        </p:commandButton>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                            <p:ajaxStatus style="height:18px;text-align:center">
                                <f:facet name="start">
                                    <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                                </f:facet>
                                <f:facet name="complete">
                                    <h:outputText value=""/>
                                </f:facet>
                            </p:ajaxStatus>
                            <p:menubar>
                                <p:menuitem type="push" value="全部复核通过" icon="ui-icon ui-icon-document"
                                            action="#{cardQryAction.onBatchAllCheck}" update="msgs,pdt"
                                            ajax="true"/>
                                <p:menuitem type="push" value="多笔复核通过" icon="ui-icon ui-icon-document"
                                            action="#{cardQryAction.onBatchMultiCheck}" update="msgs,pdt"
                                            ajax="true"/>
                            </p:menubar>
                            <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                         value="#{cardQryAction.cardList}" var="record"
                                         rowKey="#{record.pkid}" selection="#{cardQryAction.selectedCardRecords}"
                                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         paginator="true" rows="15" paginatorPosition="bottom"
                                         rowsPerPageTemplate="100,50,30,15,5"
                                         emptyMessage="没有查询到数据记录...">
                                <p:column headerText="Pkid" style="display:none;">
                                    <h:outputText style="display: none;" value="#{record.pkid}"/>
                                </p:column>
                                <p:column selectionMode="multiple"/>
                                <p:column headerText="所属项目" style="text-align: left">
                                    <h:outputText value="#{record.projname}"/>
                                </p:column>
                                <p:column headerText="卡号" style="text-align: center">
                                    <h:outputText value="#{record.cardno}"/>
                                </p:column>

                                <p:column headerText="面额">
                                    <h:outputText value="#{record.openamt}" style="float: right">
                                        <f:convertNumber pattern="###,###,##0.00"/>
                                    </h:outputText>
                                </p:column>

                                <p:column headerText="卡状态" style="text-align: center">
                                    <h:outputText
                                            value="#{cdtCardAction.cardStatus.valueOfAlias(record.cardsts).title}"/>
                                </p:column>
                                <p:column headerText="发卡日期" style="text-align: center">
                                    <h:outputText value="#{record.opendate}"/>
                                </p:column>
                                <p:column headerText="有效期" style="text-align: center">
                                    <h:outputText value="#{record.valdate}"/>
                                </p:column>

                                <p:columnGroup type="footer">
                                    <p:row>
                                        <p:column colspan="10"
                                                  footerText="记录笔数：#{fn:length(cardQryAction.cardList)}  总金额：#{cardQryAction.strSumAmt}"
                                                  style="text-align:right"/>
                                    </p:row>
                                </p:columnGroup>
                            </p:dataTable>
                        </div>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>